//  设计效验码倒计时效果
export function setTime(this_) {
  let time = 60;
  let i = 0;
  let that = this_;
  let timer = setInterval(function () {
    that.codeTxt = time + 's后重新发送'
    time--;
    i++;
    // 如果正在发送验证码的时间段 则设为不可点击
    if(i === 1){
      that.disableCode = true
    }
  },1000)
  // 300s之后 清楚300s的计时器
  setTimeout(function () {
    // 恢复获取验证码可点击状态
    that.disableCode = false
    that.codeTxt = '获取验证码'
    clearInterval(timer)
  },time*1000)
}

export function setTime2(this_) {
  let time = 60;
  let i = 0;
  let that = this_;
  let timer = setInterval(function () {
    that.codeTxt2 = time + 's后重新发送'
    time--;
    i++;
    // 如果正在发送验证码的时间段 则设为不可点击
    if(i === 1){
      that.disableCode2 = true
    }
  },1000)
  // 300s之后 清楚300s的计时器
  setTimeout(function () {
    // 恢复获取验证码可点击状态
    that.disableCode2 = false
    that.codeTxt2 = '获取验证码'
    clearInterval(timer)
  },time*1000)
}
